<html>
<head><meta charset="utf-8"><title>Miri and foreign functions · t-compiler/const-eval · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/index.html">t-compiler/const-eval</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Miri.20and.20foreign.20functions.html">Miri and foreign functions</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="156824630"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Miri%20and%20foreign%20functions/near/156824630" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Miri.20and.20foreign.20functions.html#156824630">(Jan 25 2019 at 02:55)</a>:</h4>
<div class="codehilite"><pre><span></span>constant evaluation error: can&#39;t call foreign function: sched_getaffinity
</pre></div>


<p><span class="user-mention" data-user-id="120791">@RalfJ</span> is supporting this a "not yet, but soon"; "maybe someday, but it's hard"; or "haha, noooooooooooo"</p>



<a name="156824676"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Miri%20and%20foreign%20functions/near/156824676" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Miri.20and.20foreign.20functions.html#156824676">(Jan 25 2019 at 02:56)</a>:</h4>
<p>I feel like a lot of Miri runs will hit this pretty quickly</p>



<a name="156836010"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Miri%20and%20foreign%20functions/near/156836010" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Miri.20and.20foreign.20functions.html#156836010">(Jan 25 2019 at 07:56)</a>:</h4>
<p>so this is when using Miri-the-tool, not CTFE?</p>



<a name="156836025"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Miri%20and%20foreign%20functions/near/156836025" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Miri.20and.20foreign.20functions.html#156836025">(Jan 25 2019 at 07:57)</a>:</h4>
<p>we can stub it out no problem</p>



<a name="156836028"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Miri%20and%20foreign%20functions/near/156836028" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Miri.20and.20foreign.20functions.html#156836028">(Jan 25 2019 at 07:57)</a>:</h4>
<p>do you have an example?</p>



<a name="156836038"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Miri%20and%20foreign%20functions/near/156836038" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Miri.20and.20foreign.20functions.html#156836038">(Jan 25 2019 at 07:57)</a>:</h4>
<p>we'd add it to the horror show that is <a href="https://github.com/solson/miri/blob/master/src/fn_call.rs" target="_blank" title="https://github.com/solson/miri/blob/master/src/fn_call.rs">https://github.com/solson/miri/blob/master/src/fn_call.rs</a> :D</p>



<a name="156836758"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Miri%20and%20foreign%20functions/near/156836758" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Miri.20and.20foreign.20functions.html#156836758">(Jan 25 2019 at 08:14)</a>:</h4>
<p>Open an issue with a repro test and link to the docs of the function and I'll happily impl it</p>



<a name="156857251"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Miri%20and%20foreign%20functions/near/156857251" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Miri.20and.20foreign.20functions.html#156857251">(Jan 25 2019 at 14:48)</a>:</h4>
<p><a href="https://github.com/solson/miri/issues/602" target="_blank" title="https://github.com/solson/miri/issues/602">https://github.com/solson/miri/issues/602</a></p>



<a name="156857414"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Miri%20and%20foreign%20functions/near/156857414" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Miri.20and.20foreign.20functions.html#156857414">(Jan 25 2019 at 14:51)</a>:</h4>
<p><span class="user-mention" data-user-id="120791">@RalfJ</span> is on the ball today</p>



<a name="156857438"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Miri%20and%20foreign%20functions/near/156857438" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Miri.20and.20foreign.20functions.html#156857438">(Jan 25 2019 at 14:51)</a>:</h4>
<p>nah I'm just looking for excuses not to do other work that I should be doing :P</p>



<a name="156857442"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Miri%20and%20foreign%20functions/near/156857442" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Miri.20and.20foreign.20functions.html#156857442">(Jan 25 2019 at 14:51)</a>:</h4>
<blockquote>
<p>Miri-the-tool, not CTFE?</p>
</blockquote>
<p>Yeah, there were many zulip streams that made sense, but since the error message <em>said</em> "constant evaluation"...</p>



<a name="156864720"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Miri%20and%20foreign%20functions/near/156864720" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Miri.20and.20foreign.20functions.html#156864720">(Jan 25 2019 at 16:34)</a>:</h4>
<p>Here's what I'm really hoping, <span class="user-mention" data-user-id="120791">@RalfJ</span> / <span class="user-mention" data-user-id="124288">@Oli</span> — that I will be like, "let's run Miri on {random Rust project}... oh look, undefined behavior!" and then everyone will hail me as a miraculous bug finder (and maybe Miri too, I suppose)</p>



<a name="156864864"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Miri%20and%20foreign%20functions/near/156864864" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Miri.20and.20foreign.20functions.html#156864864">(Jan 25 2019 at 16:36)</a>:</h4>
<p>I share that vision. but at this point it's no more than that, unfortunately...</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>